//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd. 
//- <https://www.chatopera.com>, Licensed under the Chunsong Public 
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
ul.layui-nav.layui-nav-tree(lay-filter='demo')
    li.layui-nav-item(class={'layui-this': subtype == 'content'})
        a.layui-nav-default(href='/admin/content.html') 系统概况
    li.layui-nav-item.layui-nav-itemed
        a.layui-nav-title(href='javascript:;') 用户和组
        dl.layui-nav-child
            if user.roleAuthMap["B02_B01"] || user.superadmin
                dd(class={'layui-this': subtype == 'user'})
                    a(href='/admin/user/index.html') 用户账号
            if user.roleAuthMap["B02_B02"] || user.superadmin
                dd(class={'layui-this': subtype == 'role'})
                    a(href='/admin/role/index.html') 系统角色
            if user.roleAuthMap["B02_B03"] || user.superadmin
                dd(class={'layui-this': subtype == 'organ'})
                    a(href='/admin/organ/index.html') 组织机构

    li.layui-nav-item.layui-nav-itemed
        a.layui-nav-title(href='javascript:;') 渠道管理
        dl.layui-nav-child
            if user.roleAuthMap["B02_B04"] || user.superadmin
                dd(class={'layui-this': subtype == 'im'})
                    a(href='/admin/im/index.html') 网站渠道
            if models.contains("callcenter")
                dd(class={'layui-this': maintype == 'callcenter' || subtype == 'channel'})
                    a(href='/admin/callcenter/index.html') 呼叫中心
            if models.contains("skype")
                dd(class={'layui-this': maintype == 'skype' || subtype == 'skype'})
                    a(href='/admin/skype/index.html') Skype
            if models.contains("messenger")
                dd(class={'layui-this': maintype == 'messenger' || subtype == 'messenger'})
                    a(href='/admin/messenger/index.html') Messenger
    if models.contains("wexin")
        li.layui-nav-item.layui-nav-itemed
            a.layui-nav-title(href='javascript:;') 微信接入
            dl.layui-nav-child
                dd(class={'layui-this': subtype == 'weixin'})
                    a(href='/admin/weixin/index.html') 公众号配置
                dd(class={'layui-this': subtype == 'material'})
                    a(href='/admin/weixin/material.html') 素材管理
                dd(class={'layui-this': subtype == 'interf'})
                    a(href='/admin/weixin/interf.html') 接口管理
                | &ndash;&gt;
    if user.superadmin
        li.layui-nav-item.layui-nav-itemed
            a.layui-nav-title(href='javascript:;') 系统设置
            dl.layui-nav-child
                dd(class={'layui-this': subtype == 'config'})
                    a(href='/admin/config/index.html') 系统设置
                dd(class={'layui-this': subtype == 'sysdic'})
                    a(href='/admin/sysdic/index.html') 字典管理
                dd(class={'layui-this': subtype == 'metadata'})
                    a(href='/admin/metadata/index.html') 元数据
                if models.contains("chatbot") && (user.roleAuthMap["A09"] || user.admin)
                    dd
                        a(href='javascript:void(0)',data-title="智能机器人",onclick="openChatbot()",data-href="/admin/system/chatbot/index.html",class="iframe_btn",data-id="chatbotIntegrationWin", data-type="tabAdd") 智能机器人
                dd(class={'layui-this': subtype == 'template'})
                    a(href='/admin/template/index.html') 系统模板
                dd(class={'layui-this': subtype == 'email'})
                    a(href='/admin/email/index.html') 邮件通知设置
                dd(class={'layui-this': subtype == 'sms'})
                    a(href='/admin/sms/index.html') 短信通知设置

script.
    function openChatbot() {
        window.parent.active.tabAdd($(".iframe_btn").data('href'), $(".iframe_btn").data('title'), $(".iframe_btn").data('id'));
    };
